Make commaspace equiv to comma on csv read.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 23 Jun 2005 17:34:28 +0000 (17:34 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 23 Jun 2005 17:34:28 +0000 (17:34 +0000)
gpsbabel/csv_util.c

index efa433f033f15cce6e2df34121337f514e99b587..7d052899993ed7dd4dc9d6747c6cacca6b1b961d 100644 (file)
@@ -185,6 +185,17 @@ csv_lineparse(const char *stringstart, const char *delimited_by,
     if (strcmp(delimited_by, "\\w") == 0)
         hyper_whitespace_delimiter = 1;
 
+    /*
+     * This is tacky.  Our "csv" format is actually "commaspace" format.
+     * Changing that causes unwanted churn, but it also makes "real" 
+     * comma separated data (such as likely to be produced by Excel, etc.) 
+     * unreadable.   So we silently change it here on a read and let the
+     * whitespace eater consume the space.
+     */
+    if (strcmp(delimited_by, ", ") == 0) {
+       delimited_by = ",";
+    }
+
     if (!p) {
        /* first pass thru */
        p =  stringstart;